package com.yiqi.zhiyuan.feature.mine.view;

import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.widget.TextView;

import com.suozhang.framework.framework.BaseActivity;
import com.yiqi.zhiyuan.R;
import com.yiqi.zhiyuan.entity.vo.DiverCenterVO;
import com.yiqi.zhiyuan.feature.mine.view.adapter.IntegralDialog;

import butterknife.BindView;

/**
 * @ProjectName: ZhiYuan
 * @Package: com.yiqi.zhiyuan.feature.mine.view
 * @ClassName: MyIntegralActivity
 * @Description: 我的积分
 * @Author:
 * @CreateDate: 2019/3/12 16:06
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/3/12 16:06
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class MyIntegralActivity extends BaseActivity implements Toolbar.OnMenuItemClickListener {
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.tv_integral_money)
    TextView mTvIntegralMoney;
    @BindView(R.id.tv_integral_cashed)
    TextView mTvIntegralCashed;
    @BindView(R.id.tv_integral_redeemable)
    TextView mTvIntegralRedeemable;
    @BindView(R.id.tv_integral_unbooked)
    TextView mTvIntegralUnbooked;

    private DiverCenterVO mCenterVO;

    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_my_integral;
    }

    @Override
    protected void initView() {
        super.initView();
        mToolbar.inflateMenu(R.menu.menu_jifen);
        initToolBar(mToolbar, getString(R.string.my_integral_title), true, true);
    }

    @Override
    protected void initInjector() {

    }

    @Override
    protected void initData() {
        mCenterVO = (DiverCenterVO) this.getIntent().getSerializableExtra("user_info");
        if (mCenterVO != null) {
            mTvIntegralMoney.setText(mCenterVO.getAccumulatedPointsMonth());
            mTvIntegralCashed.setText(mCenterVO.getAvailablePoints());
            mTvIntegralRedeemable.setText(mCenterVO.getRedeemedPoints());
            mTvIntegralUnbooked.setText(mCenterVO.getNotAccountedPoints());
        }
    }

    @Override
    protected void initEvent() {
        mToolbar.setOnMenuItemClickListener(this);
    }

    @Override
    public boolean onMenuItemClick(MenuItem item) {
        initTipsDialog();
        return false;
    }

    private void initTipsDialog() {
        IntegralDialog dialog = new IntegralDialog(this);
        dialog.show();
    }
}
